/**
 * 
 */
package com.pe.adexus.portal3g.componente;

import java.text.SimpleDateFormat;
import java.util.Comparator;
import java.util.Date;

import com.pe.adexus.portal3g.bean.CompraBean;

/**
 * @author lsalvador.ext
 *
 */
public class FechaComparator implements Comparator{
	 public int compare(Object o1, Object o2) {
		 CompraBean u1 = (CompraBean) o1;
		 CompraBean u2 = (CompraBean) o2;
		 Date date1 = null;
		 Date date2 = null;
		 try{
			 SimpleDateFormat sdfInput =  new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");  
			 
			 date1 = sdfInput.parse(u1.getFecha().trim()+" "+u1.getHora().trim());
			 date2 = sdfInput.parse(u2.getFecha().trim()+" "+u2.getHora().trim());
			 
		 }catch(Exception e){
			 e.printStackTrace();
		 }
		 return date2.compareTo(date1);

	}

	public boolean equals(Object o) {
	return this == o;
	}

}
